package com.zdp.dubbo.simulate.framework;

import com.zdp.dubbo.simulate.framework.protocol.http.HttpProtocol;

/**
 * 读取用户配置，返回对应的 Protocol实现类
 * 允许参数 -DprotocolName=http
 * @author ZhengDp
 * @Date 2023/6/4 13:13
 */
public class ProtocolFactory {

    public static Protocol getProtocol() {
        String name = System.getProperty("protocolName");
        if(name == null || name.equals("")) {
            name = "http";
        }
        switch (name) {
            case "http":
                return new HttpProtocol();
            default:
                break;
        }
        return new HttpProtocol();
    }

}
